//
//  FristLBViewController.m
//  intelligent
//
//  Created by 甘世清 on 2024/2/7.
//

#import "FristLBViewController.h"
@interface FristLBViewController ()<SDCycleScrollViewDelegate>
@property (nonatomic , strong ) SDCycleScrollView * cycleScrollView;
@property (nonatomic , strong ) HeaderView * btn;
@property (nonatomic , assign ) NSInteger index;

@end

@implementation FristLBViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.index = 1;
    self.zx_hideBaseNavBar = YES;
   
}
- (void)SQ_UIViewForSelfView{
    [self.view addSubview:self.cycleScrollView];
    [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    self.cycleScrollView.localizationImageNamesGroup = @[SQNSLocalString(@"引导页1"),SQNSLocalString(@"引导页2"),SQNSLocalString(@"引导页3")];
    
    self.btn = [[HeaderView alloc]init];
    self.btn.font = FONT_SEMIBOLD(19);
    self.btn.text = SQNSLocalString(@"下一步");
    self.btn.colorString = @"#FFFFFF";
    self.btn.layer.cornerRadius = 6;
    self.btn.backgroundColor = SQColor(@"#000000");
    [self.btn.btn addTarget:self action:@selector(SQ_toLogin) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.btn];
    [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(SCREEN_WIDETH-70);
        make.height.mas_equalTo(50);
        make.bottom.equalTo(self.view.mas_bottom).offset(-FootHeight-40);
    }];
}

-(void)SQ_toLogin{
 
   
    if (self.index == 1) {
        [self.cycleScrollView makeScrollViewScrollToIndex:0];
    } else   if (self.index == 2) {
         //跳转登录页面
        [self.cycleScrollView makeScrollViewScrollToIndex:1];
    }else   if (self.index == 3) {
//        跳转登录页面
//        [self.cycleScrollView makeScrollViewScrollToIndex:2];
//    }else{
        [Manager SQ_SetObject:@"FristLB" FormKey:@"FristLB"];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[Manager SQ_getViewController]];
        self.view.window.rootViewController = nav;
    }
    self.index ++;
}

 

 
-(SDCycleScrollView*)cycleScrollView{
    if (!_cycleScrollView) {
        _cycleScrollView = [[SDCycleScrollView alloc]initWithFrame:CGRectZero];
        _cycleScrollView.backgroundColor = UIColor.clearColor;
        _cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
        _cycleScrollView.clipsToBounds = YES;
        _cycleScrollView.infiniteLoop = NO;
        _cycleScrollView.autoScroll = NO;
        _cycleScrollView.delegate = self;
        _cycleScrollView.userInteractionEnabled = NO;
        _cycleScrollView.pageControlBottomOffset = 10;

    }
    return _cycleScrollView;
}
 

@end
